
 <template>
 	<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap" >
 		<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10;"></i>
	    <div class="bt">报损审核不通过原因</div>
 		<el-form label-width="100px" class="form">
 			<el-form-item label="物品名称">
				  <el-input v-model="form.wpmc"  :readonly="true"   icon="info" class="select-block"></el-input>
			</el-form-item>
 			<el-form-item label="原因">
 				<el-input v-model="form.btgyy" type="textarea" maxlength='120' :rows="4" placeholder="请输入原因" class="select-block"></el-input>
 			</el-form-item>
 		</el-form>
 		<el-button type="primary" class="submit" @click="submit">确定</el-button>
		<el-button type="danger" class="submit" @click="cancel">取消</el-button>
 	</el-dialog>
 </template>
 <script type="text/javascript">
 	import qs from 'qs'
 	export default {
 		props: ['params'],
 		data() {
 			return {
 				form: {
			           btgyy:'',
			           zt:2,
 					 id:''
 				},
 			}
 		},
 		created() {
  		 this.form.id = this.params.row.id;
  		 this.form.cnt=this.params.row.sl;
           this.form.wpid=this.params.row.wpid;
           this.form.wpmc=this.params.row.wpmc;
//		 this.form.zt = this.params.row.zt;
//        this.loadinfo();
 		},
 		methods: {
 			 submit() {
 				this.$store.state.loading = true;
 				if(!this.form.btgyy) {
 					this.$message.warning('请填写不通过原因');
 					this.$store.state.loading = false;
 					return;
 				}
 				//装载数据
 				var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 					    ids: this.form.id,
 						zt:this.form.zt,
 						cnt:this.form.cnt,
 						wpid:this.form.wpid,
   						btgyy: this.form.btgyy+'',
 						yhid: logininfo.id,
 						xxid: logininfo.xxid
 					})
 				//执行
 				    this.axios.post(this.$store.state.api + 'wpbs/bschk',  params2 )
 						.then(res => {
 							if(res.data.code == 1) {
 								this.$message.success(res.data.msg);
 								this.$emit('close', { type: 'bsbtg', cancel: false });
 								this.$store.state.loading = false;
 							} else {
 								this.$message.warning(res.data.msg);
 								this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.danger("服务器异常");
 							this.$store.state.loading = false;
 						})
 			},
 			cancel() {
 				this.$emit('close', { type: 'bsbtg', cancel: true })
 			}
 		}
 	}
 </script>
 <style lang="less" scoped>
 	.wrap {
 		text-align: center;
 	}
 	.bt{
		position: absolute;
		width: 100%;
		height: 50px;
		margin: 0 auto;
		top: 0;
		left: 0;
		background: #50BFFF;
		color:white;
		text-align:left;
		line-height: 50px;
		font-size: 17px;
		padding-left: 15px;
	}
 	.form {
 		text-align: left;
 		margin-top: 20px;
 	}
 	.input {
             width: 300px;
             display: inline-block;
         }
 	.select-block {
    width: 80%;
 		display: block;
 	}
 	.submit {
 		width: 120px;
 	}
 </style>
